<?
  $id     = null;
  $name     = null;
  $description = null;
  $published   = true;
  
  if(isset($this->conference)){
    $id     = $this->conference->id;
    $name     = $this->conference->name;
    $description = $this->conference->description;
    $published   = $this->conference->published;
  }
  
  $teams            = array();
  $conference_teams = array();
  if(isset($this->teams))
    $teams = $this->teams;
  if(isset($this->conference_teams))
    $conference_teams = $this->conference_teams;
  
?>

<form action="index.php" method="post" name="adminForm" id="adminForm">
<script type="text/javascript">
jQuery(document).ready(
  function(){
    jQuery("#adminForm").validate({
      rules:  {
        name: "required",
      }
    });
  }
);
</script>
  <fieldset class="adminform">
    <legend>Details</legend>
        <table class="admintable" width="100%">
                <tr>
                    <td class="key">Name</td>
          <td>
            <input type="text" name="name" id="name" value="<?= $name ?>"/>
          </td>
        </tr>
                <tr>
                    <td class="key">Description</td>
          <td>
            <?= $this->editor->display( 'description', $description, '100%', '480', '80', '15' ) ?>
          </td>
        </tr>    
        <tr>
          <td class="key">Published</td>
          <td>
            <?= JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $published); ?>
          </td>
        </tr>
             </table>
    </fieldset>
  <fieldset>
    <legend>Relationship</legend>
    <table class="admintable">
      <tr>
        <td class="key">Conference Teams</td>
        <td>
          <?
            $team_ids = array();
            if(is_array($conference_teams)){
              foreach($conference_teams as $conference_team)
                array_push($team_ids, $conference_team->team_id);
            }
          ?>
          <?= JHTML::_('select.genericlist', $teams, 'teams[]', 'multiple=multiple style="width:200%" size='.count($teams), 'id', 'name', $team_ids); ?>
        </td>
      </tr>
    </table>
     </fieldset>
    <input type="hidden" name="option" value="<?= JRequest::getVar( 'option' );?>"/>
    <input type="hidden" name="c" value="<?= JRequest::getVar('c', 'conference'); ?>" />
    <input type="hidden" name="id" value="<?= $id; ?>"/>      
    <input type="hidden" name="task" value=""/>
</form>